package com.jsu.forum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.model.forum.pojo.LikesCount;
import org.springframework.data.repository.query.Param;

@Mapper
public interface LikesCountMapper extends BaseMapper<LikesCount> {
    @Delete("DELETE FROM comment_like WHERE comment_id = #{comment_id} AND user_id = #{userId}")
    int deleteByCommentIdAndUserId(@Param("comment_id") Integer comment_id, @Param("userId") Integer userId);

    @Select("Select * FROM comment_like WHERE comment_id = #{comment_id} AND user_id = #{userId}")
    LikesCount selectByCommentIdAndUserId(@Param("comment_id") Integer comment_id, @Param("userId") Integer userId);
}
